/*
** proc_running.c for pud in mrcellophane/libpud/sys/NetBSD
** 
** Made by solomon hykes
** Login   <torgau@gmail.com>
** 
** Started on  Mon May 16 16:43:38 2005 solomon hykes
** Last update Mon May 16 18:33:58 2005 solomon hykes
*/

#include "pud_sys.h"
#include <errno.h>

t_ret	pud_continue(pud_process *p, int sig)
{
  return (pud_continue_at(p, sig, 1));
}

t_ret	pud_continue_at(pud_process *p, int sig, u_long where)
{
  sys_pud_process	*proc = (sys_pud_process *)p;

  while (ptrace(PT_CONTINUE, proc->pid, (caddr_t)where, sig) == -1)
    if (errno != EAGAIN)
      return (ret_err);
  proc->status = status_running;
  return (ret_ok);
}


t_ret		pud_step(pud_process *p, int sig)
  {
    return (pud_step_at(p, sig, 1));
  }

t_ret		pud_step_at(pud_process *p, int sig, u_long where)
  {
    sys_pud_process	*proc = (sys_pud_process *)p;

    while (ptrace(PT_STEP, proc->pid, (caddr_t)where, sig) == -1)
      if (errno != EAGAIN)
	return (ret_err);
    proc->status = status_stepping;
    return (ret_ok);
  }
